import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;

public class WindowTest extends JFrame {
    private JPanel panelScore;
    private JPanel panelGame;
    private ArrayList<Integer> scores;
    private ArrayList<String> gamers;
    private ArrayList<JTextArea> scoreAreas;
    private ArrayList<JLabel> scoreLabels;
    public WindowTest(){
        panelGame=new JPanel();
        panelScore=new JPanel();
        scores=new ArrayList<>();
        scores.add(12);
        scores.add(10);
        gamers=new ArrayList<>();
        scoreAreas=new ArrayList<>();
        scoreLabels=new ArrayList<>();
        gamers.add("1号");
        gamers.add("2号");
        scoreAreas.add(new JTextArea(String.valueOf(scores.get(0))));
        scoreAreas.add(new JTextArea(String.valueOf(scores.get(1))));
        scoreLabels.add(new JLabel(gamers.get(0)));
        scoreLabels.add(new JLabel(gamers.get(1)));

        panelGame.setBackground(Color.black);

        panelScore.setBackground(Color.green);
        panelScore.add(scoreLabels.get(0));
        panelScore.add(scoreAreas.get(0));

        panelScore.add(scoreLabels.get(1));
        panelScore.add(scoreAreas.get(1));
        add(panelGame,BorderLayout.CENTER);
        add(panelScore,BorderLayout.NORTH);
        setTitle("测试");
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setSize(640,480);

    }

    public static void main(String[] args) {
        new WindowTest();
    }
}
